package com.atguigu.dga.ds.mapper;

import com.atguigu.dga.ds.bean.TDsTaskDefinition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhangchen
 * @since 2024-07-31
 */
@Mapper
@DS("ds")
public interface TDsTaskDefinitionMapper extends BaseMapper<TDsTaskDefinition> {


    @Select("  select * from t_ds_task_definition  where  code  in (\n" +
            "    select task_code from  (\n" +
            "      select  task_code,   rank()over(partition by name order by id desc)  rk  from\n" +
            "      t_ds_task_instance where  state=7 ) tt where tt.rk=1    )")
    public List<TDsTaskDefinition> selectDefinitionList();

}
